<template>
	<view>
		<!-- <view-navbar></view-navbar> -->
		<!-- <view class="h88"></view> -->
		<!-- 1 -->
		<topbar>
			<view class=" flex-align">
				<view class="ms20">
					<view class="flex  ">
						<view class="mt8 ms8 ml48 mr16">
							<image src="/static/img/safe/54504.svg" mode="" style="width: 43rpx;height: 50rpx;"></image>
						</view>
						<view class="size_48 color_1b mr18">安全设备</view>
						<view class=" mt30 size_26 color_A5">请添加设备</view>
						<view class="flex-cen" @click="qrCode">
							<u-icon name="plus" color="#9d59f7"></u-icon>
						</view>
					</view>
				</view>
			</view>
		</topbar>

		<!-- safe -->
		<view class="">
			<!-- style="height: 1166rpx;" -->
			<view class="bg1  flex-align" style="height: 90vh;">
				<!--  -->
				<view class="">
					<!-- 1 -->
					<!-- mt238 -->
					<view class=" ml270 mr204">
						<image src="/static/img/safe/21.svg" mode="" style="width:278rpx;height: 278rpx;"></image>
					</view>
					<!-- 2 -->
					<view class="flex-cen mt12">
						<view class="color_E0 size_32">暂无设备</view>
					</view>
					<!-- 3 -->
					<view class="mt52">
						<view class="flex-cen">
							<view class="flex">
								<view class="flex-cen row" @click="$pub.go('/pages_safe/safeHas/safeHas')">
									<view class="color_EA size_26">添加设备</view>
								</view>
								<view class="flex-cen row">
									<view class="color_EA size_26">蓝牙检测</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!--  -->
		<!-- tab -->
		<tabbar></tabbar>
		<!--  -->
	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		mounted() {},
		methods: {
			qrCode() {
				var that = this;
				// 允许从相机和相册扫码
				uni.scanCode({
					success: async function(res) {
						console.log('扫码结果', res);
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						let id = res.result;
						let re = await that.$API.devApi.devBind({
							"uequipmentId": id
						});
						console.log(re, "re");
						uni.showToast({
							title: '绑定成功'
						})

						// let id = re.userId;
						// let applyData = {
						// 	ucomeFrom: '2',
						// 	udescription: '1手机号 2二维码 3圈子',
						// 	ufriendId: id
						// };
						// let ree = await that.$API.friendApi.applyAddFriend(applyData);
						// uni.showToast({
						// 	title: 'sucess'
						// });
						// console.log(ree, 'ree');
						// that.applyAddFriend(ids);
					}
				});
			},

		}
	};
</script>

<style lang="scss" scoped>
	.bg1 {
		// background: url(/static/img/safe/22.png) no-repeat center / cover;
		// background-size: 750rpx 9999rpx;
	}

	.row {
		width: 298rpx;
		height: 80rpx;
		background: #a240ff;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		opacity: 1;
		border: 10rpx solid #eddaff;
	}
</style>